<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    150. Evaluate Reverse Polish Notation
   </h1>
   <p>
    Evaluate the value of an arithmetic expression in
    <a href="http://en.wikipedia.org/wiki/Reverse_Polish_notation" target="_blank">
     Reverse Polish Notation
    </a>
    .
   </p>
   <p>
    Valid operators are
    <code>
     +
    </code>
    ,
    <code>
     -
    </code>
    ,
    <code>
     *
    </code>
    ,
    <code>
     /
    </code>
    . Each operand may be an integer or another expression.
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ul>
    <li>
     Division between two integers should truncate toward zero.
    </li>
    <li>
     The given RPN expression is always valid. That means the expression would always evaluate to a result and there won't&nbsp;be any&nbsp;divide&nbsp;by zero operation.
    </li>
   </ul>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> ["2", "1", "+", "3", "*"]
<strong>Output:</strong> 9
<strong>Explanation:</strong> ((2 + 1) * 3) = 9
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> ["4", "13", "5", "/", "+"]
<strong>Output:</strong> 6
<strong>Explanation:</strong> (4 + (13 / 5)) = 6
</pre>
   <p>
    <strong>
     Example 3:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]
<strong>Output:</strong> 22
<strong>Explanation:</strong> 
  ((10 * (6 / ((9 + 3) * -11))) + 17) + 5
= ((10 * (6 / (12 * -11))) + 17) + 5
= ((10 * (6 / -132)) + 17) + 5
= ((10 * 0) + 17) + 5
= (0 + 17) + 5
= 17 + 5
= 22
</pre>
  </div>
  <div>
   <h1 class="question_title">
    150. 逆波兰表达式求值
   </h1>
   <p>
    根据
    <a href="https://baike.baidu.com/item/%E9%80%86%E6%B3%A2%E5%85%B0%E5%BC%8F/128437" target="_blank">
     逆波兰表示法
    </a>
    ，求表达式的值。
   </p>
   <p>
    有效的运算符包括&nbsp;
    <code>
     +
    </code>
    ,&nbsp;
    <code>
     -
    </code>
    ,&nbsp;
    <code>
     *
    </code>
    ,&nbsp;
    <code>
     /
    </code>
    &nbsp;。每个运算对象可以是整数，也可以是另一个逆波兰表达式。
   </p>
   <p>
    <strong>
     说明：
    </strong>
   </p>
   <ul>
    <li>
     整数除法只保留整数部分。
    </li>
    <li>
     给定逆波兰表达式总是有效的。换句话说，表达式总会得出有效数值且不存在除数为 0 的情况。
    </li>
   </ul>
   <p>
    <strong>
     示例&nbsp;1：
    </strong>
   </p>
   <pre><strong>输入:</strong> ["2", "1", "+", "3", "*"]
<strong>输出:</strong> 9
<strong>解释:</strong> ((2 + 1) * 3) = 9
</pre>
   <p>
    <strong>
     示例&nbsp;2：
    </strong>
   </p>
   <pre><strong>输入:</strong> ["4", "13", "5", "/", "+"]
<strong>输出:</strong> 6
<strong>解释:</strong> (4 + (13 / 5)) = 6
</pre>
   <p>
    <strong>
     示例&nbsp;3：
    </strong>
   </p>
   <pre><strong>输入:</strong> ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]
<strong>输出:</strong> 22
<strong>解释:</strong> 
  ((10 * (6 / ((9 + 3) * -11))) + 17) + 5
= ((10 * (6 / (12 * -11))) + 17) + 5
= ((10 * (6 / -132)) + 17) + 5
= ((10 * 0) + 17) + 5
= (0 + 17) + 5
= 17 + 5
= 22</pre>
  </div>
 </body>
</html>